package com.msb.servicemap.service;

import com.msb.internalcommon.dto.ResponseResult;
import com.msb.internalcommon.reponese.DirectionResponse;
import com.msb.servicemap.remote.MapDirectionClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.nio.MappedByteBuffer;

/**
 * @Auther: jiudianliu
 * @Date: 2023/6/2 - 06 - 02 - 16:01
 * @Description: com.msb.servicemap.service
 * @version: 1.0
 */
@Service
public class DirectionService {


    @Autowired
    private MapDirectionClient mapDirectionClient ;

    /**
     * 根据起点经纬度和终点经纬度获取距离（米）和时长（分钟）
     * @param depLongitude
     * @param depLatitude
     * @param destLongitude
     * @param destLatitude
     * @return
     */

    public ResponseResult driving( String depLongitude , String depLatitude , String destLongitude , String destLatitude ){

        //调用第三方地图接口
        DirectionResponse direction = mapDirectionClient.direction(depLongitude, depLatitude, destLongitude, destLatitude);

        return ResponseResult.success(direction) ;
    }
}
